#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
int main(int argc,char **argv)
{
   pid_t pid;
   
   /* Remove the defunc pid in process table */
   //signal(SIGCLD, SIG_IGN);

   while(1)
   {
      switch(pid=fork())
      {
         case -1:
           printf("Fork failured!\n");
           break;
         case 0:
           printf("This is child thread!\n");
           _exit(0);
           break;
         default:
           printf("Child process %d created!\n", pid);
           sleep(1);
           break;
      }
   }
   return 0;
} 
